<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateQuestionTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('question', function (Blueprint $table) {
            $table->increments('id')->comment('问题id');
            $table->string('question')->notNULL()->comment('题干')->index();
            $table->tinyInteger('type')->notNULL()->comment('题型')->index();
            $table->string('select')->notNULL()->comment('选项');
            $table->tinyInteger('selectnumber')->notNULL()->comment('选项数量');
            $table->string('answer')->notNULL()->comment('答案');
            $table->string('intro')->nullable()->comment('答案解析');
            $table->tinyInteger('level')->nullable()->comment('难度');
            $table->integer('subject')->nullable()->comment('科目')->index();
            $table->integer('sections')->notNULL()->comment('章节')->index();
            $table->integer('points')->nullable()->comment('知识点')->index();
            $table->integer('order')->nullable()->comment('排序')->index();
            $table->integer('author')->nullable()->comment('录入人')->index();
            $table->enum('status',[1,2])->notNULL()->default('2')->comment('状态');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('question');
    }
}
